﻿CREATE VIEW [dbo].[UserInstalledAddinsLatestEx] AS
SELECT u.[InstanceId]
      ,u.[Submission]
      ,u.[ListIndex]
      ,a.[WhsAddinId]
      ,a.[HslAddinId]
      ,a.[UpdatedDate]
      ,a.[LastSyncDate]
      ,isnull(a.[ProductCode],u.[ProductCode]) as [ProductCode]
      ,isnull(a.[Author],u.[Author]) as [Author]
      ,isnull(a.[Title],u.[Title]) as [Title]
      ,isnull(a.[Version],u.[Version]) as [Version]
      ,a.[HslCategoryId]
      ,a.[AuthorUrl]
      ,a.[ChangeLog]
      ,a.[ChangeLogUrl]
      ,a.[DescText]
      ,a.[DownloadCount]
      ,a.[DownloadUrl]
      ,a.[ForumUrl]
      ,a.[Rating]
      ,a.[ReleaseDate]
      ,a.[Requirements]
  FROM [WhsAddins] a
  RIGHT JOIN [UserInstalledAddinsLatest] u
  ON a.[ProductCode]=u.[ProductCode]
  